She was at a loss as to which road to take.

Literal

She [topic-は] which [genitive-の] road [object-を] should-go [explanatory-question-のか] way-was-lost.

途方に暮れる literally 'be benighted at the way' — a poetic image of someone standing at a crossroads at dusk, unable to choose. The のか marks the embedded clause as a question being pondered, not asked. Together they paint a picture of paralysis at a fork rather than active deliberation. The expression has an old, slightly literary feel, common in narrative.