Do active noise cancellation headphones cancel out noise even if no music is being played, assuming the noise cancellation feature is turned on?
Yes, you will get noise cancellation even if you're not playing music. Don't take my word for it - any search engine should give you hits like this and this. There are some that will cancel noise even if the input plug from the headphones is removed.
Keep in mind that many would consider ear protection/isolation or high quality/custom earplugs to be a much more cost effective solution.
I would say that it does depend on the brand, and the hardware used.
I can tell you that Bose QC15s and QC3s actively cancelled out background hum and noise when activated even when there was no signal through the input cable. The system remained active indefinitely until turned off.
I would expect these days however that some brands may have 'auto-off' features if an input signal is not detected after a period of time.
Typically, yes, the noise cancellation function is independent of playing music (or whatever) through the headphones. Remember that the noise cancellation is limited, even in the best NC headphones. For example higher-frequency noise is cancelled to a much higher degree than low frequency noise (which may not be cancelled at all).