I'm sure it would work to prevent headaches. Most headaches I've had were caused by having to deal with other people, and people are unlikely to come up and talk with me if I'm wearing one of those things.
But maybe I'll just stick with my tinfoil hat--it serves the same purpose.