A query on Hamiltonian formulation as explained in 3rd edition of Goldstein's "Classical Mechanics" book In 3rd edition of Goldstein's "Classical Mechanics" book, page 335, section 8.1, it is mentioned that :

In Hamiltonian formulation, there can be no constraint equations among
  the co-ordinates.

Why is this necessary? Any simple example which will elaborate this fact?
But in Lagrangian formulation, there can be constraint equations. Then why not in Hamiltonian formulation?
 A: Goldstein is presumably trying to say that he will for simplicity not consider such cases in his book. But it is possible. See also Ref. 1.
Example: Consider Lagrangian 
$$L~=~\frac{m}{2}\left(\dot{x}^2+\dot{y}^2\right) + \lambda y ;$$
with constraint
$$ y~\approx~0; $$
with corresponding Hamiltonian
$$ H~=~\frac{1}{2m}\left(p_x^2+p_y^2\right) -\lambda y -\kappa p_y;$$
and $\lambda$ and $\kappa$ are Lagrange multipliers. 
References: 


*

*M. Henneaux & C. Teitelboim, Quantization of Gauge Systems, 1994.

A: You can have constraints, if those constraints are holonomic/geometric and can be eliminated by reduction of the configuration space. Eg. if you have spherical pendulum of length $l$ and instead of taking $\mathbb{R}^3$ as the configuration space, you take $S^2$, with spherical coordinates, then you can use the Hamiltonian formalism fine.
If the constraints are such that they appear via multipliers or some other means and they cannot be eliminated by reduction, then the Legendre transform might be ill-defined.
If you are into field theory, then the part of the appendix in Wald's General Relativity that deals with Lagrangian and Hamiltonian formulations might be illuminating. He performs a reduction of the configuration space for electrodynamics, but he shows that so far it is impossible to do so with GR. The Hamiltonian description nontheless works for GR, but this does pose problems for quantization, which Wald once again details.
