Since we wish to restrict ourselves to the constrained subspace only, this suggests that the Hamiltonian, or any other physical observable, should only be defined on that subspace. Equivalently, we can look at the equivalence class of smooth functions over the symplectic manifold, which agree on the constrained subspace (the quotient algebra by the ideal generated by the f 's, in other words).