We start with a general time-homogeneous scalar diffusion whose state space is an interval I ⊆ ℝ. If it is started at x ∈ I, then we consider the problem of imposing upper and/or lower boundary conditions at two points a,b ∈ I, where a < x < b. Using a simple integral identity, we derive general expressions for the Laplace transform of the transition density of the process, if killing or reflecting boundaries are specified. We also obtain a number of useful expressions for the Laplace transforms of some functions of first-passage times for the diffusion. These results are applied to the special case of squared Bessel processes with killing or reflecting boundaries. In particular, we demonstrate how the above-mentioned integral identity enables us to derive the transition density of a squared Bessel process killed at the origin, without the need to invert a Laplace transform. Finally, as an application, we consider the problem of pricing barrier options on an index described by the minimal market model.