How do I lock an object's rotation?

I’ve been rigging this model, and encountered a problem with the Kneecap armor it has. I want the kneecaps to move along with the bones, but also maintain their rotation in order to expose the red parts, how could I do this?
(In other words, I want the kneecaps to stay straight.)

Use a driver or constraint on the kneecap, that tracks the rotation of the leg bones and corrects it’s own rotation to compensate.

The question is not very clear , first thought is to use an extra bone for the kneecap that will not inherit rotation and have a limit rotation constraint. But i do not see how global rotation can be prevented when the whole character turns.