Is there a way to lock a bone axis? rigging
You have two options, while in pose mode you will find a Transform Locks panel in the bone properties, these are also available in the 3D viewports properties region N. This can prevent a user transforming specific axes.



A more rigid approach is to use constraints, There are several limit transform constraints that will prevent bones being moved or rotated outside of your settings. Here you can also set limits, so you can allow a bone to rotate 30 degrees on one axis.

The transform locks only apply to the viewport, an fcurve or driver can move a bone with these locks enabled. Constraints are applied after fcurves so can prevent an extrapolated fcurve from going outside your settings.

Update for 2.8x

From 2.80 the transform locks have been moved into the same panel as the transform values. They also don't visually stand out as buttons.