I'm not sure what you mean by "waterproof" for the charger? Is it designed to douched by a hose while operating? It's not designed to be submerged -- maybe sprayproof is okay?
Ventilation is the next issue. In general a closed lazarette can get filled with stuff that blocks the ventilation and degrades the output of the charger. Usually in an overheating situation, the charger will reduce it output -- but some just cut-out and need to be reset?
An engine room isn't an ideal location; but, it depends on "compared to what" and how you use the boat. If you motor a lot, by the time the batteries need a charge, then your engine comparment may have cooled enough...but if you had an inverter, that might be a different issue. If you sail in cooler climes, it makes things better. you can run the blower to ease some of the heat load, etc.