Tickets with refund option is quite pricey and basically there is not a big choice here. Kind of obvious way to go is purchase your tickets via
OeBB (Austrian Railways) customer service and do so for the direct overnight train #346/347 Vienna-Bucharest (since it is a direct train there will be no problem). But once you get your visa (as far we understand you applying for Romanian visa, but flying in/out of Vienna, thus Schengen will be a transit, right?), you can simply return these tickets and opt for a cheaper option (depends on timing you've got before departure)
Anyway ;there is NO solution to what you ask, as you cannot buy such a ticket online.
In this case Online-Ticket isn't the only option for the abroad travelers, because OeBB offers so called ticket purchase via email (Customer Service form), it's not an online ticket, thus can be returned if the passenger in advance contacts OeBB