Taking damage while in a dig site knocks you out of it, but you're not fully in the world, so skills won't work, you can't queue, interact with menus etc and the only option is to quit the game. Once you've managed to kill the add attacking you (or in my case my pet did) there's no option to return to the dig site.