Placement of transformer for indoor/outdoor LED light string
Actually this warning can be for wire wound transformers and switching power supplies that do not have a protective shell where water and or moisture can damage the device.
Adding a water / moisture tight enclosure with approved sealing grommets or bushings would be a code legal way to do this.
In most cases a NEMA 3R case will be sufficient.
In all cases A NEMA 4 -4x weather proof is enough this is normally what we use in areas close to where vehicles are pressure washed or steam cleaned to protect the controls.