A vote to extend funding past a midnight deadline failed in the US Senate, with the government inching towards a shutdown, amid almost no hope of a resolution.