The Shulchan Aruch rules that money set aside for Purim tzedaka cannot be switched over to a different tzedaka, but the recipient may do with that money whatever he wishes even if it had been given with the intention of providing for the Purim Seudah.
If a person offers tzedaka to someone who refuses to accept it, the Taz rules that one does not have to give that money to tzedaka at all, while others say that he must give that money to a different poor person.
Sometimes a collection is made for a certain poor person with a specific cause, and then it turns out that he already has received enough for that cause. In such a case the extra money may be diverted to other poor people, or may be used to provide other things the poor person needs.
If a collection is made for hachnassat kallah and then the engagement is broken, the money collected should still be given to the kallah to provide for her needs when she does eventually get married. Similarly, a collection of money was gathered to start a certain gemach but it did not materialize, so the Chazon Ish ruled that the money should be given to a different gemach.
If a person pledged a certain sum of money to a yeshiva, and after giving half of it the yeshiva closed down, the basic halacha does not require him to give the other half to tzedaka, unless he had a general intention to support Torah learning – in which case he should give it to a different Torah institution.
The following rules generally apply:
1) If the person was mistaken in his commitment to give in the first place, there is no neder and he does not have to give anything.
2) If he was not mistaken, but the reasons for giving to this particular case no longer apply, he should give to a similar cause as long as it seems that was included in his intentions.
3) If he wanted to give specifically to this case and it is no longer applicable to give to it, he does not have to give any more – although it is proper to get a Chacham to matir it.