JavaScript executes asynchronously so the code to create your KMLLayer starts but isn't finished when you're trying to access the folders property. To get your folder info, connect to the KMLLayer's onLoad event:
kmlUrl = 'http://www.hpc.ncep.noaa.gov/kml/qpf/QPF6hr_f00-f06_latest.kml';
kml = new esri.layers.KMLLayer(kmlUrl);
map.addLayer(kml);
dojo.connect(kml, 'onLoad', function(kl) {
alert('kml loaded. folder[1].name is: ' + kl.folders[1].name);
});
This pattern applies to all layer types in the JS API.