In principle key signatures apply to all octaves, while individual accidentals apply only to the octave, where they appear. Sometimes score editors are helpful by repeating individual accidentals (courtesy or cautionary accidentals); if these are not especially marked (smaller print, parentheses) it makes the rule more diffcult to recognize for the inexperienced.
In the strict sense, even an accidental in small print (e.g. within an ornamentation) applies to all notes up to the end of the bar.
I revised my answer according to Eduards comment, but even if I found the information, that individual accidentals on in the octave where they occur in every reference I encountered, I received nothing but astonishment from every professional musician I asked. So I would summarize:
While individual accidentals theoretically apply only to the specific octave, this can't be relied upon: few people (including sheet editors) are aware of the rule, so in case of doubt, use what sounds more appropriate.