This issue recently came up at work and this is what I have found. While 508A does not clearly define "ambient temperature", I found a Siemens UL Guideline that explicitly defines it as follows:
"Ambient temperature according to UL 508 and 508A:
The ambient temperatures specified in these standards are measured 3 to 4 feet (around 1.20 meters) outside the industrial control panel. This is not the temperature in the panel near the industrial control equipment. This is referred to as "surrounding air temperature"."
So according to this, it is in fact referring to the ambient for the enclosure. I would take this to mean any enclosure, regardless of internal cooling, that is subject to ambient temperatures above 104F(40C) Does not conform to UL508A, thoughts?