How does this sentence follow the "V2" rule, if the verb is the third word in the sentence?
It doesn't depend on the exact number of words, but on the number of noun phrases, i.e. subjects and objects. For example in this case, "farven gul forms a noun phrase, just like "the colour yellow" in English. These words are the subject of the sentence. They are a single grammatical unit and cannot be separated by anything else.
Noun phrases consist of a central noun and any attributes for them, which are usually adjectives, articles, and relative clauses. Here a more extreme example:
Min mors venlige kat, som jeg meget elsker, kom ind i værelset. - My mother's nice cat, whom I love a lot, came into the room.
Here the central noun is kat, and it's attributed by the adjective venlig, the possessive "min mors", and the relative clause "som jeg meget elsker". These are all part of the subject, and the verb kom follows right after.