She had no idea what to wear to the party.

Literal

She [topic-は] party [to-に] what [object-を] wear-and-go [if-ば] should [question-か] became-at-a-loss.

途方に暮れる is a vivid set phrase literally meaning 'to get lost in the path,' i.e. 'to be at a complete loss, to be unable to figure out what to do.' The embedded question 何を着ていけばよいか forms a noun-phrase clause inside the larger sentence: a wh-question (何) plus the conditional ~ばよい ('it's enough to / one should X') gives 'what one should wear,' all bundled by the final か into a single nominal serving as the implied target of her bewilderment. 着ていく ('wear-and-go') is itself a compound — wearing as the manner of going somewhere.