Rate law only cares about REACTANTS. Since, rate law can only be determined experimentally, I am assuming the given reaction mechanism is elementary reaction from which we can write the rate law.
Only H2 and O2 are part of rate law since they are reactants and also the coefficient in front of H2 goes as exponent on rate law to indicate the order of H2 in the reaction.