Spray foam is a chemical product created by two materials, isocyanate and polyol resin, which react when mixed with each other and expand up to 30-60 times its liquid volume after it is sprayed in place. This expansion makes it useful as a specialty packing material which forms to the shape of the product being packaged and produces a high thermal insulating value with virtually no air infiltration.

If you don't have the patience to slowly fill the void with spray foam through holes drilled in one of the studs, you could (if you were an experienced carpenter) use a Sawzall to remove one of the studs and re-frame the corner as a two-stud corner. Then you could either insulate the void with a fiberglass batt or simply present the two-stud corner to the spray-foam contractor as an accessible corner.
During colder months, 2 component foam is very sensitive to temperature variances. Per product instructions, both tank temperatures need to be above 70°F (21°C) for at least 24 hours prior to use. All application surfaces should be clean/dry and above 60°F (16°C) prior to application. Variance outside of the recommended temperature can affect foam yield and performance. https://youtube.com/v/ggLAUsiuI_o?version=3
Spray polyurethan foam does effectly prevent all six of these heat transfer methods from occurring. These should be the mechanisms by which you judge insulation, in addition to their R-Value. If you're uncertain about installing spray foam insulation, Energy Star has a map that recommends levels of insulation by R-value and cost-effectiveness in the United States.
Most flat roofs are not perfectly sloped, causing water to puddle in some areas, in particular around the drains and scuppers. Many roof coatings are not rated or warranted for "ponding water", and thus might fail pre-maturely if exposed to standing water over long periods of time. Serious consideration should be given to the performance and limitations of the coating being selected. Some manufacturers will warranty their coatings including ponding water. Typically, manufacturers for acrylic roof coatings do not include warranties for ponding water, while some polyurethane and silicone roof coatings manufacturers will.
A. You can use closed-cell spray foam that way if you want, although you should realize that the spray foam will prevent the roof sheathing from drying inward. This approach should only be used if the roof sheathing is bone dry, because it will never dry when sandwiched in this manner. Most building scientists would prefer to see fiberglass rather than closed-cell spray foam under the roof sheathing in this type of assembly.

Roof Coating Seal