Foam is a great way to insulate a roof as long as you have enough of it and reach efficient R value (insulation Value) The rafters/roof framing/ trusses must be hermetically sealed in order to be effective, This method is highly recommended in a vaulted or attic type ceiling. If there is no air then there is no chance of condensation, as for the the dew point, it would exist at the center of the foam which is clearly impossible, no vapor barrier or air barrier required. It is costly.