From Halopedia, the Halo wiki
Play through the level normally until you get into the long tunnel in which you have to drive a 'Hog or a Type-32 Ghost. When you go in there, go past the first "Loading" message. When it is done, turn around and drive all the way back to the crashed Pelican near where you got the first Warthog. Continue past the Pelican. The Invincible Warthog is on a platform on the right. If you came here before, then the Warthog will not show up. Jump up and use the Rocket Launcher or drive into the little planters in front of the Warthog to get it off the platform (this may take a few attempts). This Warthog can be damaged, and its Cowlings can be removed, but the Warthog can not be destroyed. However, the player can still be killed while inside the Warthog.
Another way to get an invincible Warthog is to go to any level that you can get a Warthog and have an NPC (Rtas 'Vadum or Sergeant Johnson) get inside the Warthog. As long as they are inside, the Warthog is invincible. This will also work with Spectres and Scorpions. This is because vehicles will usually only explode when the driver dies, (if you are invincible the Warthog will not explode) and as Johnson and Rtas 'Vadum are both invincible the vehicle they are in can't be destroyed.