This paper concerns the pricing of American options with stochastic stopping time constraints expressed in terms of the states of a Markov process. Following the ideas of Menaldi et al., we transform the constrained into an unconstrained optimal stopping problem. The transformation replaces the original payoff by the value of a generalized barrier option. We also provide a Monte Carlo method to numerically calculate the option value for multidimensional Markov processes. We adapt the Longstaff-Schwartz algorithm to solve the stochastic Cauchy-Dirichlet problem related to the valuation problem of the barrier option along a set of simulated trajectories of the underlying Markov process.