Spacetimes with a separable Klein-Gordon equation in higher dimensions