How to limit the rotation of knees, feet, ankles and similar joints?
Edit:
In looked back at this old answer and realized you were using an IK rig. To limit this, there is an inverse kinematics section to the bone properties.

Select the bone you want to constrain, and make sure you are in posed mode. There should be a bone constraints window:



By check boxing 'limit' you can set a bone to only bend so far in IK mode.

_________________________

  Old Answer




You can add a "limit Rotation" constraint, as you can see set up there. 
It also has other bone limitations; go ahead and mess around with it.