Women: Want a promotion? Find a boss whose wife has a career.

FORTUNE — Let’s suppose you’re female and puzzled by why you keep getting passed over for promotion — despite having qualifications equal to, or maybe even better than, your male peers’. Here’s a factor you probably haven’t considered: If your boss is a married man, what does his wife do for a living? If she’s a stay-at-home spouse, he is less likely to see you as a serious contender in the workplace than if she has a career of her own outside the home.

At least, that is the conclusion of a study, based on six years of research covering 1,200 men in the U.S. and Britain, led by management professor Sreedhari Desai. Male managers whose wives are homemakers are “a pocket of resistance to the gender revolution in the workplace,” says Desai, who teaches at the Kenan-Flagler Business School at the University of North Carolina and at Harvard.

In five separate research projects, she says, “We found that employed husbands in traditional marriages, compared to those in modern marriages, tend to view the presence of women at work unfavorably — and, more frequently, to deny qualified female employees opportunities for promotion.”

Why is that? A big part of the reason is that everyone’s “home environments can shape the way we behave at work,” the study notes. “People are daily ‘border crossers’ between the domains of work and family,” and leaving one’s home life entirely behind at the office door requires a conscious effort.

“The men we studied were all nice guys who really believe that they are capable of seeing female colleagues as equals. They were not deliberately holding women back,” Desai points out. “Rather, in the vast majority of cases, they were basing their decisions on unconscious biases they didn’t realize they had.”

In one experiment, 232 married male managers were asked to evaluate two competing MBA candidates and told that one of the two would receive a full salary and tuition reimbursement during B-school and a promotion to vice president afterward. The two (fictional) candidates were identical in every way, with “exemplary experience and award-winning leadership capabilities,” the study says.

The only difference: One was named David Blake, and the other’s first name was Diane. Men in traditional marriages overwhelmingly chose David. By contrast, the responses of the managers married to women with careers of their own were split almost equally between the two.

Unfortunately for women who aspire to corporate heights, the study notes, male managers “embedded in traditional marriages” are a large group (about 11 million in the U.S., according to the Bureau of Labor Statistics), and a powerful one: “These men are more likely [than both women and other men] to populate the upper echelons of organizations … [and] to earn more, another indicator of their influence.”

Moreover, Desai suspects that the kind of diversity training most companies do (if they do any at all) is likely to fall on deaf ears with these bosses. “If you try to have a discussion about how people’s unconscious beliefs shape their decisions, it’s very difficult to get anywhere, because no one believes it,” observes Desai. “Everyone will say, ‘I’m sure some people do have unconscious attitudes [that favor men over women who are equally qualified]. But not me.’”

For diversity trainers hoping to get around that, Desai suggests asking people to take a quiz called the Implicit Association Test, which is designed to bring buried beliefs out into the open. “This test is a revelation to many people who take it,” she says. “And you don’t need to ask anyone to reveal their score. The object isn’t to embarrass anyone or put anyone on the defensive, but rather to hold up a mirror so that people become aware of what may be hidden in their own psyches.”

Of course, it’s unlikely that 11 million married male executives are all going to sit down and take this test, let alone start acting on whatever they learn from it. So, for women who want a fair shot at advancement, a word of advice: To the extent that you can choose whom to work for, if you are going to work for a married man, go with one who has a career-minded spouse.