Aah, yes, in that case mechanical stops are right out. I'm a little confused by your drawing though, your XOR gate only has one input, and it looks like AND gate 1 has three inputs.
It sounds like you're probably using the EasyDriver v3, or something similar as your stepper motor driver, but in either case I'm assuming you're using something that steps on the positive edge of the pulses. Also, are you talking about just one limit switch, like a "home position" switch? At first I thought you meant safety switches at both ends of the range of motion, which would make things a bit more complicated.
I think you can set up a home switch that works like you described with just a single transistor and a few passive components, if you use a SPDT switch (like this one for example):
When the switch is not pressed, the the pulse and dir lines are directly connected, but when the switch is pressed, the dir line has to trip the transistor to let pulses through. The resistor on the right pulls the pulse line low during the switch transition, and while the dir line is keeping pulses from going through. The capacitor prevents switch bounce in the unlikely event that the switch is thrown during a pulse while the direction is being switched to move back away from the switch. If you don't have one lying around you can probably leave it out.
This circuit is a a little backwards from your original description (when the switch is pressed it lets pulses through when DIR is high and blocks them when DIR is low), but it's about as simple as you can get. You can reverse the rotation direction of the stepper motor by swapping the wires of one of the windings to make it work. If it absolutely has to be the way you described, you can use a PNP transistor instead.
P.S. To answer your last question, you can use a transistor and some resistors to invert a logic signal, like this:
Note: That's an NPN transistor, if you were to use a PNP transistor you would want to flip the output line and the 1K resistor to the ground side. This diagram is from the Transistor circuits page of the Electronics Club website, which has lots of nice little circuits like this and some other basic electronics background info.