Begging is not something that your dogs does inherently to get what they want. Instead, it is a learned behavior and they determine over time whether it works or not. Does your dog get food when they beg? Do they get your attention? If so, it's because they have learned that begging gets them what they want.
So how do we flip this around so that your dog gets what they need on your watch, rather than what they want on their watch? We can teach them that all begging does is get them sent out of your space. By teaching your dog a command like "get out", you can help them understand that when they pester you, you're going to send them away.
Teaching your dog the "get out" or "space" command is simple! Cue that they get out of your space with your body language, say "get out!" with a stern, low voice, and then toss them a treat once they leave your bubble. The main point is to teach them that the most rewarding response to your request is that they move outside of your space.
Another key in teaching your dog not to beg is to simply not give them what they're begging for. Are they begging for food? Don't feed them directly after they've been begging. Are they begging for a walk? Have them wait in a down-stay for a solid minute until you call them over to where you put their leash on. Remember, the goal is to give them what they need on your watch, not what they want on their watch.