You need NFPA 110, and (I think) 54 Fuel gas code. There is nothing preventing running the exhaust outside and placing genset inside, it's done all the time, usually with schedule 40 or 80 black pipe.
The fire truck engines run inside, so can the genset, but just like you put the exhaust tubes on the trucks to work on them, be careful with the exhaust. You do need a drain at the low point, and must consider any windows, etc.