Where in the bible is Be in the world not of the world?

The concept is expressed in these verses:

1 John 2:15-17 (KJV) 15 Love not the world, neither the things that are in the world. If any man love the world, the love of the Father is not in him. 16 For all that is in the world, the lust of the flesh, and the lust of the eyes, and the pride of life, is not of the Father, but is of the world. 17 And the world passeth away, and the lust thereof: but he that doeth the will of God abideth for ever.

It is in 1 Corinthians 9:19-23, especially in the paraphrased version of the Bible, coming from The Message, "Even though I am free of the demands and expectations of everyone, I have voluntarily become a servant to any and all in order to reach a wide range of people: religious, nonreligious, meticulous moralists, loose-living immoralists, the defeated, the demoralized-whoever. I didn't take on their way of life. I kept my bearings in Christ-but I entered their world and tried to experience things from their point of view. I've become just about every sort of servant there is in my attempts to lead those I meet into a God-saved life. I did all this because of the Message. I didn't just want to talk about it; I wanted to be in on it!")

Romans 12:2 also says "And do not be conformed to this world, but be transformed by the renewing of your mind, that you may prove what is that good and acceptable and perfect will of God."