Self-adjoint, globally defined Hamiltonian operators for systems with boundaries