"If i separated the compartment with a metal wall with some insulation would that help?"
That is a sure fire recipe for disaster. The one thing these inverter generators can't stand is heat. Even if the engine were to survive, the generator head will over heat, melt the insulation on the windings and fail--thats if the computer doesn't fail first. It takes a whole lot of air to keep a generator happy, so if you can devise a way to roll the genny out when you need to use it will have a longer life.
Having preached all that, I do have my 3K inverter genny in a compartment and so far so good. Of course I added both a pusher and a puller fan, both thermostatically controlled and an over temp shut down. I also removed the exterior casement and relocated the computer and operating electronics to the inside of my bus to help control the heat load. Jack