A small additional note: In music, an accidental in "in effect" until the end of the measure. Thus, if the first B in the measure is an accidental B-flat, then any other B's in the measure are also flat.

From a compositional point of view, the accidentals are there to allow you to use notes that are not properly "in" the key you're writing in. So, while all B's in the key of C are natural, you could slip in an accidental if you really wanted a B-flat, just this once. (Well, for the rest of the measure. Then again, if a measure has three B's, and the first is an accidental flat, but the second is an accidental natural, then, well, the third is natural too. Freaky, huh?)