Yes, you can. This is a common strategy for most bosses. You can dig a tunnel under the larger altars that the bosses can't fit through. There, you can place your bed and crafting stations so that you can hop right back into the fight if you're playing with others. Dig deep but leave yourself a quick exit.