Position a prim where you want to rez the object concerned, rotate it to have the same facing that you want the object to rez with, and then drop this script into it.
Droppable into any vehicle. When the vehicle is moving, it checks every half second to see if you are going to collide with ban territory within the next half second. If so, it sets the vehicle non-physical (though this will likely confuse the thing mightily, so something a bit more integrated would be better.)