Electron and nuclear density matrices and the separation of electronic and nuclear motion