The Gaza health ministry told the Reuters news agency that Israeli fire had caused the deaths at the school in Beit Hanoun on Thursday. .
An Israeli military source however told Al Jazeera that Palestinian rocket fire had been detected in the area and that it might have fallen short and hit the shelter.
Al Jazeera's Stefanie Dekker, reporting from Gaza, said she was unable to reach the school after the attack due to heavy Israeli shelling. No one she had spoken to in Gaza believed the deaths were caused by a Palestinian rocket.
In an interview with Al Jazeera, Chris Gunness, the spokesman for UNRWA, the UN's humanitarian organisation in Gaza, said his organisation had been in contact with Israeli forces as fighting closed in on the shelter.
"We gave the Israelis the precise GPS coordinates of the Beit Hanoun shelter. We were trying to coordinate a window [for evacuation] and that was never granted," he said.
At least 16 people have been reported killed and 150 injured in the bombardment of a UN school in northern Gaza used to shelter civilians from fierce clashes on the streets outside.
He said he could neither confirm nor deny that Hamas fighters were near the building, but said Israel and Hamas "must respect the inviolability of UN premises, and humanitarian law".
He called the attack "tragic and appalling".
Robert Turner, the director of UNRWA, told Al Jazeera there was no warning from the Israelis before the shells landed.
"This is a designated emergency shelter," he said. "This was an installation we were managing, that was monitored [to ensure] that our neutrality was maintained."
Israel has attacked UN schools before, saying that they were being used as safe havens for the armed Palestinians.
The UN has also previously criticised the Palestinian groups for using UN schools to hide fighters and weapons.
'No fighters at school'
A witness who arrived at the Kamal Adwan hospital after the bombardment told Al Jazeera: "We were sitting in the school, because we were told it is safe.
"By God, there was not a single fighter, not a single shot was fired from the school. Why did they shoot at the school? Why? Can someone explain that to me? Why would they shell the school?"
Thursday's strike is the fourth time a UN facility has been hit since Israel's offensive was launched on July 8.
At least 815 Palestinians have been killed and more than 5,240 injured in the Israeli assault, according to the health ministry in Gaza.
Two Israeli civilians have been killed by fire from Gaza since the offensive began.
The total number of Israeli soldiers killed since the start of the military assault stands at 32. One more soldier has been listed as missing and is believed to be dead.