UN Director [of Operations in Gaza] John Ging was actually in telephone contact with the Israelis before they attacked the UN compound, telling them that bombing was coming quite close. Ging told the Israelis that they should avoid hitting the UN compound.
The Israelis knew its coordinates, they knew exactly where it was, they could see it from the air very clearly. Ging told the Israelis that there were hundreds of refugees there, and that there were fuel tanks near the building, which if hit could create a massive explosion.
Ging told them that if they hit it with the white phosphorous bombs that were raining down around the city, there could be an enormous tragedy. But the Israelis went ahead and hit it anyway. Fortunately, there were some very brave people who ran out during the fire bombing and moved the trucks away, so they didn't have that explosion.
Just one of many incidents described in this article.