I've seen 다니 as a short form of 다고 하니까, but I don't think it means that here.
What does 다니 mean in '하필이면 그런 남자와 결혼 하다니', and what is the general pattern?
다니 (or 라니 after noun) is used after verbs or adjectives to express your feelings such as surprise, joy, or anger. It could also be used when you realized new things.
In your sentence, the feeling the speaker expresses would be anger or disappointment. Usually we need an additional sentence following 다니. Possible expressions omitted in your sentence could be "I can't believe it" or "She must have a unique taste".
Let me cite as an example a famous story of Wolfgang Pauli when his wife left him for a chemist.
그가 투우사라면 이해할 수 있었을 것이다. 하지만 평범한 화학자라니!
If it had been a bullfighter I could have understood. But a common chemist...
A few more examples:
시험에서 100점을 받다니 꿈만 같다.
I got 100 points in the exam. It must be a dream.
내가 너한테 지다니 말도 안돼.
I lost to you. Impossible!
날씨가 이렇게 덥다니 벌써 여름인가 보다.
The weather is so hot. It must be summer already.