A building in Bangkok that had been under construction collapsed, killing at least eight people, while dozens of workers remained stuck in the rubble.