That might be the lesson taken from this pair of stories:
UN Halts Gaza Aid Over "Thefts";
UN To Resume Aid Supplies To Gaza.
The timeline seems pretty conclusive: Hamas steals UN food supplies; UN withholds all supplies; Hama returns food. A successful piece of hardball negotiation, you might think. But what were the ethics of withholding the food?
At one level, it seems like an action taken against Hamas. The intention, certainly, was to withhold the food from them. But, given that UNRWA is the only or main supplier of food to Gaza, the effect was to make the entire population of Gaza suffer for Hamas' actions. And, in fact, UNRWA almost certainly did intend to use that suffering, and the (further) unpopularity it would cause Hamas' in Gaza, as the incentive for Hamas to change its ways.
Israel's longer and more comprehensive blockade of Gaza was held, by no means unreasonably, to be collective punishment of civilian's for the actions of their government and as such, arguably a crime against human rights. What of UNRWA? In both cases, we have an entity denying basic and vital supplies to the people of Gaza. In both cases, the purpose is to effect a change in Hamas' policy. What are the differences?
One difference is the scope of the issues. Israel's blockade was aimed at weakening and isolating Hamas generally, as an enemy of Israel, as well as forcing a ceasefire. The UNRWA's withholding of aid was directly related to a specific Hamas action - the theft of that aid. So UNRWA could argue that their actions were not punishing Gazans for the fact that Hamas holds power there. UNRWA could also argue the lack of alternatives: either it sent in aid trucks, or it didn't. Lacking it's own enforcement capability, what choices did it have?
However, just because your only option is an unethical one doesn't mean you have to take it. The key question in fact is what was happening to the food Hamas confiscated. If it was being distributed by Hamas as a "public works" PR offensive - that is, if much the same amount of food were going to much the same people as would have recieved it direct from UNRWA - then withholding the food does punish Gazans for the actions of Hamas. If, on the other hand, Hamas distributed the food mainly or exclusively to its own fighters, or used its control of the food supply to maintain or increase its hold on power, or selectively withheld it to punish its internal enemies, then the situation is different. In that case, continuing with food aid would have put UNRWA in the position of supplying and supporting a terrorist group, and effectively of taking sides in an armed conflict. This is, obviously, both in the short and long term, an exceptionally bad idea.
Now, it's not immediately clear what Hamas planned to do with the food supplies. But, and call me prejudiced if you will, I do incline to think the worst of them. So I'd say UNRWA probably did the right thing (which will come as a relief to them, no doubt). But it's interesting how close even humanitarian goals can take us to unethical behaviour.