First, regarding your second question (which is actually much easier to answer), the apostrophe is typically used to avoid ambiguity when a particular combination of latin letters could actually indicate two different possible ways of writing things in kana. For example, if I write "nya" in romaji, is that supposed to indicate にゃ, or んや? Not everyone uses the apostrophes reliably, but when they do, にゃ would be "nya" and んや would be "n'ya" to keep the distinction clear. (In some cases, particularly with automated transliteration, though, systems will just always include an apostrophe after ん (n') to always remove any possible ambiguity without having to have complicated logic about looking at what actually comes after it and figure out whether it's actually needed or not, so that's how you sometimes get things like "nihon'nouta" which does not technically need it, but uses it anyway (though that always just kinda feels sloppy to me, personally))
Regarding use of spaces, there are some common conventions, but actually no hard rules, and different transcribers will often choose to do things somewhat differently. Some of the things that I think are pretty common in general are things like:
- Spaces are placed after most particles
- Spaces are placed before starting any new noun, initial verb, adjective, or adverb.
However, some differences which I have seen:
- Some transcribers will choose to put a space between a word and its following particle, but some will include the particle on the end of the preceding word.
- Some will put spaces between a て-form verb and another verb which follows it, but some do not.
- Some will separate "helper verbs" from the main verb they are attached to, and some do not.
- Some will separate verb endings (such as "imasu") from their verbs, and some consider them to all be part of the same word.
- I have sometimes seen two words joined by の as being written all together without spaces, though I think this is not that common.
- I have sometimes seen some particles such as と attached to the front of the verb that follows them, when it is a commonly used combination (for example, "toomoimasu")
Personally, I prefer separating particles entirely, and treating て-form verbs as their own words separate from what comes after them most of the time, but if something is using a common convention of helper verbs (いく/くる/もらう/etc) which are written in hiragana (not kanji) to indicate they are being used as helpers, then I will include them with the main verb as part of the same "word". I also always keep verb endings/etc attached to their base as part of the same word.
(I also tend to transcribe the particle は as "wa", を as "o", etc, because IMHO romaji transcriptions are mostly useful for reading/pronunciation by people who are not well versed in Japanese, and therefore it is more generally useful to write things as they are actually pronounced, not based on some arbitrary writing convention about how particular kana are used by Japanese speakers, but again, there is no hard convention on this and different people do it different ways)
So I would personally write 空は青いと思います in romaji as "sora wa aoi to omoimasu", but it's also arguably not possible to call Google's version "wrong" either, because there is really no absolute standard of correctness here, and lots of this is a matter of interpretation or personal (or mechanical) preference...