Male privilege is “I have a boyfriend” being the only thing that can actually stop someone from hitting on you because they respect another male-bodied person more than they respect your rejection/lack of interest.
And I'm not convinced that that's why saying that would stop an interested man. I think two other factors play into this. One is that some women (most, actually, I think) value persistence, and see it as romantic that someone would keep trying. So I think that keeps some men trying longer than they otherwise would.
The other factor I see is the subtext that I automatically read into bringing it up. That is, that "I have a boyfriend" seems like a partial statement to me, and implies a second half, "And I'm happy being with him".
I can certainly think of cases where men implicitly devalue a woman's opinion on relationship matters, but I'm not convinced that this is one of them.