Dino,
I had exactly the same problem as you describe with my second hand purchased 21 mm (which is actually brand new, no wear and anyother sign of malfunction). It would fit very well on the camera, but not lock and therefore it could be turned back easily and I risked to drop the lens on use.
I had various phone-calls with the official dealers in both Holland and Germany and got no real answer (other than "send it to us and we do not know what it will cost"). There was a discussion also on this site with various persons among others with Sander van Geffen, who actually dropped his lens and also can not lock it propoerly anymore) on the possible causes.
From all the phone-calls and discussions one thing is clear: the bayonet construction is fragile and the adjustment of the inner and outer bayonet versus each other is tricky and the main reason for the locking mechanism trouble. But I was not keen on sending a new lens to the reair man without taking a much closer look. Fortunately I was in the environment of Muenster in Germany, where the guys from Photo Koester took a look at my lens and have given me some advice and this actually triggered my action. I have investigated my 21mm lens bayonet with a 10 times magnifying glass and I discovered a little burr on the edge of the square shaped "pit" into which the pen of the camera flange locks. It was much less than a hair in thickness and 1 mm long. I have taken it away with a very small screwdriver (making sure the minuscule piece was not falling into the lens as well). And that simply FIXED IT. Very simple, it now fits as the best of my 4 lenses.
So where I cannot give you a better advice I think you need to take a good look at the square pit to see and measure whether the locking pen can freely move into it while you rotate the lens.
I have tried to upload a picture of what I mean and hopefully this clarify it sufficiently. I am not stating this is the only possible cause, it probably is a likely one certainly if you did not drop your lens or something, but it is still kind of new. It illustrates however how awfully critical the shape of the bayonet construction is. In case the photo dos not come over well, mail me your address via this site, so I can send you a larger picture.
If you are not really technical, I advise you to go to an official repair provider, it is tricky stuff altogether.
Good luck.