Jesus gives the prayer in John 17 specifically for His disciples and for a specific reason. It was not the time to pray for any other than His disciples. However, this does not mean that Jesus never prayed for anyone but a disciple!
If we are supposed to pray only for converted brethren but not for our unconverted countrymen, how can we follow Jesus' many other examples and commands about this topic? For example, Matthew 5:44-45, 48:
But I say to you, love your enemies, bless those who curse you, do good to those who hate you, and pray for those who spitefully use you and persecute you, that you may be sons of your Father in heaven; for He makes His sun rise on the evil and on the good, and sends rain on the just and on the unjust. . . . Therefore you shall be perfect, just as your Father in heaven is perfect.
What a statement! He says praying for people outside the church is part of what defines us as children of our Father in heaven! Those who hate us and spitefully use us are certainly not fellow church members or converted believers, yet our Savior commands us to pray for them! There is perhaps no clearer passage on this topic!
In fact, how many of those whom Jesus prayed for and healed were "in the church" or had God's Spirit? Probably none of them! How many were worldly sinners? Certainly most of them, maybe even all of them!
Later, while hanging on a stake, Jesus practices perfectly what He preaches, once more praying for people of the world: "Father forgive them, for they do not know what they do" (Luke 23:34). What clearer example could we have?
In fact, though Jesus did not participate at all in any of the world's evils, He lived His life among the people. As the son of a carpenter, He interacted with the public constantly. He never shied away from the people of the world. He enjoyed people, weddings, and parties enough to be accused—falsely, of course—of being "a glutton and a winebibber." He felt comfortable accepting an invitation to dinner at the house of a Pharisee—He was even bold enough to invite Himself to dinner at the home of Zacchaeus, an ill-reputed tax collector.
How do we fare among the world? Are we comfortable with our "unconverted" neighbors? Would we accept dinner invitations and attend social occasions? Jesus, our Elder Brother, did. Jesus was not like the Pharisees—the very name means "the separated ones"—who acted "holier than thou." Yes, we should separate ourselves from the ways of the world. Yes, we should live a holy life (I Peter 1:15-16). After all, we have the Holy Spirit. But we should not be like those "who say, 'Keep to yourself, do not come near me, for I am holier than you!'" (Isaiah 65:5). God says of them, "These are smoke in My nostrils."