The dynamic optimization problem in the presence of uncertainty (model mismatch and disturbances) is addressed. It has been proposed that this problem can be solved by tracking the necessary conditions of optimality in the various intervals of the solution. In this paper, it is shown that the standard neighboring extremal approach, which uses linearization around the optimal trajectory, drives to zero the first-order variation of the necessary conditions of optimality on the parts of the solution where no constraint is active. This fact is used to extend the neighboring extremal approach to singular problems. In singular problems, the linearization around the optimum lacks the information needed to build a neighboring extremal controller. This paper proposes to use the nonlinear dynamics to provide the lacking information. The theoretical ideas are illustrated for singular problems on a simple semi-batch chemical reactor.