Static electricity can be defined as the imbalance of electric charges on the surface of a metal or an object. The static electricity can be produced by rubbing two objects against each other. The rubbing of objects creates negative charges called electrons.
Hair rubbed in it do not produce static charge. But when hair is rubbed against any object like it produces static charges. Even rubbing a balloon on your head causes a static charge. When the rubbing occurs the electrons are transferred from hair to balloon and then the balloon acquires negative charge and hair acquires a positive charge. when we pull the balloon the opposite charges on the hair tend to attract the balloon. So hair rubbed in air do not produce charge but when rubbed against any object produces static charge.