To put the verse in context, let's look at 1 John 1: 8-9 (Amplified Bible)
8If we say we have no sin [refusing to admit that we are sinners], we delude and lead ourselves astray, and the Truth [which the Gospel presents] is not in us [does not dwell in our hearts].
9If we [freely] admit that we have sinned and confess our sins, He is faithful and just (true to His own nature and promises) and will forgive our sins [dismiss our lawlessness] and [continuously] cleanse us from all unrighteousness [everything not in conformity to His will in purpose, thought, and action].
Some (or perhaps many) Christians believe that 1 John 1:9 is addressed to believers but I disagree.
Looking at verses 8 and 9 in tandem, I submit that Paul is actually painting a scenario of 2 choices available to a non-believer:
1) Say that you have no sin i.e. refusing to admit that you are a sinner and therefore not accepting the truth of the Gospel i.e. you don't need the Saviour because there is nothing to be saved from.
2) Confess your sins i.e. admitting you are a sinner and therefore needing and receiving God's forgiveness of all your sins and made righteous before God i.e. cleansed from all unrighteousness.
I submit that 1John 1:9 is describing what happens at the point of salvation for an unbeliever. When the unbeliever confesses before God that he is a sinner and in need of the Saviour, his sins are all forgiven and he is cleansed from ALL unrighteousness, thereby making him fully righteous. I use the word fully to emphasize the absence of any unrighteousness because strictly speaking, righteousness is a state of being so you are either righteous or unrighteous.
When you become a believer, you are made righteous before God; you have been cleansed from ALL unrighteousness, so how can there be any unrighteousness left in you for God to cleanse again and again?
For an in depth understanding of 1 John 1:9, I recommend the following two articles:i) http://sg.geocities.com/saltandlight5/trueconfession.html