All of the elemental gases, save the Noble gases, are bimolecular, i.e. #H_2, N_2, O_2, F_2, Cl_2# etc. When we solve an empirical formula we are typically given a percentage with respect to carbon, and hydrogen, and maybe halogen. The, oxygen if it is present, is assumed to be missing percentage, i.e. the percentage that brings the sum of the percentages up to 100%. Oxygen percentage is difficult to measure; not least because it is hard to separate atmospheric oxygen from the sample you want to analyze.
Note that we would make the same assumption if the sample contained #Cl# or #Br#; except here the halide content could be directly determined by a Mohr titration.