Here is the tutorial on burrow detection:
http://www.staredit.net/index.php?tutorial=236Basically you move or create a unit at a very small location that is centered on the unit. If the unit is burrowed, the unit you created or moved will be at the location. If the unit isn't burrowed, the unit won't be created or moved at the location. Then you just use the order action to unburrow the unit.