If you’ve spotted a black and yellow flying insect digging into the ground it might be a Mining bee. Also referred to as digger bees, these flying insects are solitary bees which nest in burrows in the ground. Unlike many social wasps and bees controlled by a queen they don’t form long-lived colonies, nor do they live inside one well-defended nest. Instead, each mining bee female usually digs an individual burrow to rear her own young. Mining bees are not aggressive and can be good for the garden.
Mining bees occur in loose groups, but are not social insects like honey bees or paper wasps. They are what’s called ‘sub-social’ in that they don’t have a hive of divide labour between workers and queens like fully social bees and wasps, they have a commune-like system where there all live in the same place and they are all closely related and share resources including food locations, but they rear their own young. So, they are primitive social insects- evolution isn’t dull!
Miner bees can sting, but only do it very rarely and only when defending their eggs. Their stings don’t hurt much either: they only rate a 1.0 on the Schmidt Sting Pain Index.
In the garden Mining bees are extremely beneficial insects. They pollinate many different types of plants and their burrowing does not harm vegetation and may be beneficial in aerating the soil. If you do have them in the garden it would be advisable to wear shoes as they are not likely to sting you unless you tread on them. If they are really causing a problem, wait until autumn/winter and dig the nests up or turn the soil over in that area. The brood chambers won’t be that deep and it should prevent recurrence the following year.