How to lock rotation of a part?

What do you mean by lock? Could you elaborate? On what axis you want it to rotate?