In Parshas Re’eh, in middle of the parsha discussing the Mitzva of Tzedaka, the torah warns us (Re’eh 15:9) that even when Shmitta is coming, we still must lend money to those who need. It would be wicked to stop lending just because Shmitta will wipe out the loan. Rav Yaakov Kamenetzky in Emes L’Yaakov says that we see from here that even giving a loan to a rich person who needs to borrow money is considered Tzedaka.
Therefore, says Rav Yaakov, it seems that if a person who owes you money for a loan goes bankrupt and does not pay, you should be able to subtract this amount from your Ma’aser since initially you gave the money for tzedaka and now your are not getting it back. Obviously this is only in a case where there was no Heter Iska and no interest was charged. In that case it is not considered a loan but rather a business partnership (for at least half the amount). L’halacha, Rav Yaakov says that this needs further clarification.
It should be noted that Reb Yaakov refused to allow his tshuvos to be published for fear that his words would be misconstrued. Certainly in this case no halachic decision should be based on his words. They are brought to raise the question and not to pasken halacha. The footnote in Emes L’Yaakov brings that the Noda B’Yehuda discusses this shaila (2:196).