It is not obvious from your post if you already bought your ticket or not.
If you did not, but need a ticket for applying, the following tip might be useful: According to a post at flyertalk (http://www.flyertalk.com/forum/british-airways-executive-club/476102-refund-being-denied-visa.html), it is common practice to buy a full-fare ticket, apply for the visa, and then cancel the fully-refundable ticket when the visa decision has been made. In case the visa is accepted, then you buy a new ticket at a lower price. This might be against the rules of the visa application, though, so please check.
Also note that there are some airlines that have an explicit money-back policy for such cases. You would use the formal letter by the embassy that your visa has been denied to use the policy.
If you did book your flight already, your fare is non-refundable, and your visa was denied, you can still try to contact customer service and ask for a refund anyway. Especially if you manage to elevate the issue, there is a chance that they will make an exception.
And finally, even if that does not work out, and cancellation is not possible, but there is the possibility to do a change-for-a-fee, then you can try to cancel the flight, and you can redeem the money already spent on a later flight with the same airline, possibly elsewhere (minus the change fee).