So basically, the clue here is that it's not saying "enemyName.hp" it's saying "unknown_object.hp". If you make an object called "derp" and run "stuff = lol" in a step event, you will get an error saying "derp.lol" isn't set.
In other words, the issue is not the variable but the object is running code it shouldn't. Probably caused by a destroyed object running code after being destroyed (which makes sense regarding your statement that it happens after the boss is destroyed)
Honestly, not sure exactly how that's happening, but hope that helps lol. I believe instance_destroy() will cause an object to continue running it's current event code which would cause issues, but I mean... that's the top of the event. Hopefully someone else can figure it out from here.
On a random hunch you can maybe hack fix this by running the destroy object code somewhere in the object itself and exiting, or (more likely) delaying the room transition a frame (perhaps by handling the transition in the controller, checking if the boss exists or not). But I'm curious how that's even happening. Where is instance_destroy() being called anyways? Room transitions have some weird ordering to events and are a source of mysterious bugs sometimes. Calling an immediate transition from a destroy event isn't something I'd risk given their nature. Either way, taking out the room transition and testing a few times will narrow down the issue.
In any case, you might get more accurate help by retitling as "[unsolved] unknown_object on room transition", since that's the problem at this point, not variable definitions (and I like rob, don't use them, haha, I think a lot of people don't know how they work)