Method for knitting a three-dimensional knitted fabric