In my (limited) experience, you need to do more than just ask for a number when it comes to baristas and waitresses. The reason for that is you don't really need any confidence to approach them. If a woman is just walking around in the mall or on the street you have to risk rejection simply by talking to her. Talking to a waitress or barista doesn't risk any rejection, so you're not displaying any confidence either.
My go-to move it to simply "space-out" for a few seconds starting at her, then interrupt her and give her a genuine compliment. "wow, you have the most gorgeous blue eyes". Most guys won't have the balls to do that, so that's your chance to display your confidence and build her attraction. You could also not even ask for her number, just ask her when she's free and tell her to meet you back at the coffee shop for the date. That will build her attraction too, because she'll want to text you but can't because she doesn't have your number.
The goal is simply to make yourself stand out from the hundreds of other guys she sees every day. No doubt lots of guys ask for her number every day, so if that's all you do you're really limiting your chances of getting a date with her.