Dyeing one's hair does not cause or prevent hair lice infestation. Head lice can only be caught by contact with an infested individual or an item that has come into contact with an infested individual.
According to the Centers for Disease Control and Prevention, head lice is contracted by head-to-head contact with someone or something that has head lice or lice eggs on it. If a person was dyeing their hair and used a hair brush or comb that held hair lice, they could contract lice in that fashion; however, the dyeing itself would not have any effect on the lice transference. Hair dye does not prevent transmission.