Hydrogen bonding occurs in molecules where hydrogen is bonded to highly electronegative atoms like nitrogen, oxygen, or fluorine. Dimethyl ether does not exhibit hydrogen bonding because the hydrogen atoms are not directly bonded to an electronegative atom.