.OAM plugins are actually .ZIP-files in disguise and so they are exported/upacked in to a server cache on upload to be accessible. Then DIV embed method only then snaps your Hype widget and not the head section into your page. Meaning any definitions in Head are left stranded in the server cache (and not embedded).
Solution 1:
Add your head code to a init function on your first scene (each layout) on scene load. In that case you would only need the window.myHypedocument = hypedocument portion of it.
Solution 2:
Embed as iFrame as in that case the whole html from the OAM file is used and your head html is render into the iFrame. Has the downside of iFrame if you need to access other parts of your page from within Hype (Sandbox etc.)
Solution 3:
Use something like this …
…and put it into head or a init function as this method has the benefit of determining the local hypeDocument without polluting the window scope. But that kind of consideration is only relevant if you got two or more Hype documents using your current technic. As myHypedocument is already take by the first Hype embed you would need to change the name to myHypeDocument2 etc. The script from solution 3 avoids this but only works from within a Hype document (as it "tree walks" up the DOM to find it's corresponding hypeDocument reference).
Your consideration! Your question leads to a room with at least three doors … step through one of them.
Regards.