In this situation of placing a bed, sleeping, and then removing the bed, you would not respawn at that location if you died. You would instead respawn at the world's original spawn point. In order to respawn at a bed, the bed still needs to be there when you die. If your bed is removed or obstructed, you will respawn at the world spawn point with the message 'Your home bed was missing or obstructed.'
So, if you're just sleeping for the purposes of passing the night so you can explore in relative safety, there's no problem with removing the bed. If you are sleeping for the purposes of setting your spawn, you must leave the bed behind in order to maintain that spawn point.