How do i lock out a axis

I am making game that is a top down 2-d game. I only want things to move in x and z, keeping anything from going to y. The problem is, i have the AI set on a waypoint system that uses rigidbodies, and some times when either myself, or other enemies collide with a enemy, it knocks them up or down in the y axis, making them impossible to shoot and kill yet they can still hit me, as they are scripted to aim in all 3 axis which is fine as it is universal and looks cool.

So the bottom line is, how can i lock the objects in x and z and out of y. My thought was to have it keep resting it's y axis every frame in the update function, but i have no clue how to do that, and i fear it would either look jumpy, or make it lag a lot.

the best way is to use a configurable joint and lock the motion in y axis. you can do something like this in update with

transform.position.y=0;

but using joints is the correct way.