It doesn't work, because I can't select the locked layer.
Not exactly sure what you mean by "protect from layer alignment", but there's a million ways to enforce a layer to stay stationary from adding a dummy hold keyframe to a simpel expression with fixed values...
For example you've two text layers. Layer A and layer B with completly various x- and y-values. If I select both of them and hit the vertical align button, they will both take position in the y-value-middle of them.
Hope you understand me now.
If you don't want a layer to be part of the alignment, don't select it?
Otherwise what Mylenium said should work.
Sorry for the late answer...
I've done it like Myllenium said... Added an expression to the position value of the layer which should be fixed with the fixed values. But you have to hit the align button multiple times because it uses the middle between the two layers.
However, now it's in position
For those of you who couldn't figure out a clear solution, combining what has already been said, I figured out a little system that might help someone who likes to line up their objects WITHOUT have to move-one-of-the-objects-that-you-so-carefully-already-placed...
Simply copy the position of the importantly-placed object (let's call it object A) that you don't want to move, and then select that and the other object you want to align and hit the center align (or whatever align you want). If you are already lost and don't see the Align tab, you can find it the "Windows" menu.
Obviously object A & B are now aligned but are out of place. Now parent object B (that you didn't copy the keyframe from) to the important object A. Next, paste the original position back into the important object A, and both will return to the original spot.
It's not as nice an abobe built-in solution, but hey at least it works.
and by the way, you can use this for more than two and it works for text as well...