The building, constructed on a former canal, collapsed on Tuesday night, crushing a row of tin-roof shanties where labourers were sleeping.
"People sleeping inside the shanties and in the building did not have time to escape," Muhibul Haque, a city official, said.
"Twelve people were rescued alive. The injured were sent to hospital."
Fire officials and the army said rescue efforts are being hampered by the narrow winding streets in the area, and by live electricity wires and leaking gas pipes.
Abdus Salam, a fire official, said the owners of the building were adding another floor when the collapse occurred.
The building is owned by a former government official, and preliminary reports suggest that he did not have the permits required to add new floors.
Jahangir Kabir Nanak, the cabinet minister in charge of overseeing local governments, has ordered an investigation into the collapse.
Building collapses are common in Dhaka, a city of 10 million, where construction laws are seldom enforced. At least 70 people died in one of the worst incidents, when a garment factory collapsed outside the city in 2005.
Experts have warned that more than half of Dhaka's buildings would collapse if the country is hit by a powerful earthquake.