Engies, turtle in! Put your back up against a corner; preferably at a choke point on whatever map you're playing. Build your nest (dispenser/sentry) directly in front of you. If you did it right, you can't get out of your hiding spot without blowing up one of your buildings.
This makes a great aggressive defensive position, and can often help "funnel" your team toward the enemy base/control point as they turn your dispenser into a choke point. If you’ve built up in the right spot, enemies should be crossing your path pretty regularly. If this doesn’t happen for a while, you should probably find a better hangout. You'll be able to repair both buildings at once without moving, and you are almost impossible to backstab. Nonetheless, spy check as often as possible.
A couple more notes; this works best in interior areas, and won’t work for long against a concentrated assault by the enemy team. Always make sure you are not building in a Sniper's line of sight. A great location to try this is one of the main base entrances on 2Fort. Build your sentry facing outward, towards the bridge. Once fully upgraded you'll be able to harass snipers and soldiers from the enemy battlements with your rockets!