Denmark has called a snap general election for 1 November after the government lost the support of a key ally in parliament.