To easily avoid being stung by a bee, just press 'Start' and select 'Save and Continue.' This will refresh the environment and remove the flying bees, avoiding the need to run into a building or catch them. The beehive will still be on the ground after the save completes.
You can avoid bees when you shake trees by opening your town gate to allow people to visit. Now you can shake trees for furniture, bugs, and bells without the risk of getting attacked by an angry swarm.