It's been a long time since I was a law student. However, as I recall the rules of trusts in common law countries (assuming this thing is covered by those rules):
1. If you take a donation from A on behalf of B, you are now a trustee. That means you're bound by fiduciary duty, which is a very strict standard of behaviour[1].
2. If you can't find B, or if B refuses to accept the donation, you must return it to A. It cannot be repurposed for other beneficiaries.
3. If you repurpose the funds for yourself, you have breached fiduciary duty and are legally in deep, deep shit.
The exceptions are, of course, if you explicitly formed a trust with explicit terms allowing you to select other beneficiaries.
Of course, the laws vary according to jurisdiction. Trusts caselaw has evolved slightly differently in different common law countries. And legislatures are typically suspicious of trusts because they get used a lot to reduce tax burdens, so there tends to be a lot of local tinkering with the trusts laws.
I am not a lawyer, this is not legal advice.
[1] http://en.wikipedia.org/wiki/Fiduciary