On optimal control problems with state space constraints