Typical roof coating dry film thickness vary from paint film thickness (plus or minus 3 dry mils) to more than 40 dry mils. This means a roof coating actually becomes the top layer of a composite roof membrane and underlying system. As such, the roof coating is the topmost layer of protection for the membrane, receiving the impact of sunlight (both infrared and ultraviolet (UV), rain, hail and physical damage.
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.