So they definitely were in Arrendelle to attend cousin Elsa’s coronation. But they were strangely absent when the visiting dignitaries trapped in Arrendelle (like Hans, the Irish and Italian ambassadors, and the Duke of Wesselton) conferred during the crisis. My guess is Hans needs to neutralize the entire royal bloodline of Arrendelle to cement his claim to the throne, and Rapunzel is a full cousin to Elsa and Anna. Not wanting to risk open war with Corona, Hans merely has Rapunzel and Eugene detained until she agrees to renounce her claim to the throne of Arrendelle.
Of course, both Rapunzel and Eugene have managed to escape from worse prisons (Pascal’s tongue as a lockpick, perhaps?), and lead Hans’ henchmen on a merry chase. They find a room in the royal palace and lock the door with the guards just moments behind them. Leading to this scene:
"Princess Rapunzel, give it up! You’re unarmed and outnumbered!"
Rapunzel and Eugene desperately look around the room they’ve locked themselves in. Their facial expressions change from breathless despair to wild glee and anticipation when they realize they’re in the royal KITCHENS.
Eugene: Oh, we’re outnumbered, all right…
Rapunzel: … but I wouldn’t say we’re UNARMED.
*cue awesome frying pan-fu scene*