I wouldn't mention my boyfriend casually and without purpose. If I bring him up and refer to him as my boyfriend versus just by name, it's generally with the intention of sending the guy I'm talking to a message that I'm neither single nor interested.
I do cause 95 percent of my stories involve him. That's what happens when he's been around for the last 8 years of my life haha we've gone on lots of adventures. It's simply impossible not to bring him up.
They just want to make it clear they're taken. I don't usually say it unless I feel like they're trying to hit on me. I never want to be that girl that just says "sorry I have a boyfriend" when a guy just says hi, but I do want to make it clear I'm not interested.
Considering I do a lot of stuff with my boyfriend I'm sure he's bound to come up in conversation. It's not like I'm trying to throw him out there though. I don't do that unless I feel the need to, like if the person is trying to flirt with me or something.