For a real Borel measurable function b, which satisfies certain integrability conditions, it is possible to define a stochastic integral of the process b(Y ) with respect to a Brownian motion W, where Y is a diffusion driven by W. It is well-known that the stochastic exponential of this stochastic integral is a local martingale. In this paper we consider the case of an arbitrary Borel measurable function b where it may not be possible to define the stochastic integral of b(Y ) directly. However the notion of the stochastic exponential can be generalized. We define a non-negative process Z, called generalized stochastic exponential, which is not necessarily a local martingale. Our main result gives deterministic necessary and sufficient cond...