First thing: If there's something that you have to do in order to complete the sprint, do it, and make sure to record it.
That means that if you are discovering a new task required to complete a story, add it to the story, make note of the increased remaining tasks (or hours) in your burndown chart, and mark it as unplanned work.
If this is a task that is unrelated to any story that you are currently committed to, you should (assuming that you really must) do it, record it, and mark it (unplanned). You should consider adding a story that describes the reason (who & why) you're doing it.
The important thing, is to analyze the unplanned work during your retrospective; you should strive to minimize these occurrences, by spending more effort on planning, and communicating the importance of the stability of the sprint (as may be the case).
In any case, I'd advise against a dogma of "we're agile / doing scrum, so we can't do it in this sprint". Be really agile, and inspect, learn and adapt.