I was thinking that naturally, the Holy Spirit, Spirit of holiness, or Spirit of God was thought of differently in Old Testament times than when after God’s Kingdom broke into this world (Luke 17:21). If we have been born again, we don’t need to worry about God taking His Holy Spirit from us.
Here is a great concise answer by a Facebook friend of mine:
“David’s anxious plea is not meant to cast a shadow on the doctrine of the perseverance of the saints but an indicator of the human anxiety that naturally befalls man on account of sin.”
–Warren Cruz via Facebook
Treasury of David – Spurgeon’s commentary and collections of writings on them:
Take not thy Holy Spirit from me. Withdraw not his comforts, counsels, assistances, quickenings, else I am indeed as a dead man. Do not leave me as thou didst Saul, when neither by Urim, nor by prophet, nor by dream, thou wouldst answer him. Thy Spirit is my wisdom, leave me not to my folly; he is my strength, O desert me not to my own weakness. Drive me not away from thee, neither do thou go away from me. Keep up the union between us, which is my only hope of salvation. It will be a great wonder if so pure a spirit deigns to stay in so base a heart as mine; but then, Lord, it is all wonder together, therefore do this, for thy mercy’s sake, I earnestly entreat thee.
Verse 11. Cast me not away. Lord, though I, alas! have cast thee from me, yet cast me not away: hide not thy face from me, although I so often have refused to look at thee; leave me not without help, to perish in my sins, though I have aforetime left thee.
–Fra Thomé de Jesu.
Verse 11. Take not thy Holy Spirit from me. The words of this verse imply that the Spirit had not altogether been taken away from him, however much his gifts had been temporarily obscured…Upon one point he had fallen into a deadly lethargy, but he was not “given over to a reprobate mind; “and it is scarcely conceivable that the rebuke of Nathan the prophet should have operated so easily and suddenly in arousing him had there been no latent spark of godliness still remaining…The truth on which we are now insisting is an important one, as many learned men have been inconsiderately drawn into the opinion that the elect, by falling into mortal sin, may lose the Spirit altogether, and be alienated from God. The contrary is clearly declared by Peter, who tells us that the word by which we are born again is an incorruptible seed 1Pe 1:23; and John is equally explicit in informing us that the elect are preserved from falling away altogether. 1Jo 3:9. However much they may appear for a time to have been cast off by God, it is afterwards seen that grace must have been alive in their breasts even during that interval when it seemed to be extinct. Nor is there any force in the objection that David speaks as if he feared that he might be deprived of the Spirit. It is natural that the saints, when they have fallen into sin, and have thus done what they could to expel the grace of God, should feel an anxiety upon this point; but it is their duty to hold fast the truth, that grace is the incorruptible seed of God, which never can perish in any heart where it has been deposited. This is the spirit displayed by David. Reflecting upon his offence, he is agitated with fears, and yet rests in the persuasion that, being a child of God, he would not be deprived of what, indeed, he had justly forfeited.
ESV Study Bible Note:
Ps. 51:11 take not your Holy Spirit from me. Some have taken this to imply that the Holy Spirit can be taken from someone, at least in the OT; others have suggested that the Holy Spirit is viewed here in his role of empowering David for his kingly duties, and that this is a prayer that God not take the kingship and the divine anointing for kingship from David as he did from Saul (see note on 1 Sam. 16:14; cf. 1 Sam. 16:13). To evaluate these views, one should observe that the OT rarely discusses the Holy Spirit’s role in cleansing the inner life (besides here, Ezek. 36:27 is the main OT text on the subject), and certainly does not enter into technical questions of the Spirit’s permanent indwelling. Further, the fact that this is a psalm for the whole congregation argues against the idea that this is David’s personal prayer about his kingship. The whole tenor of this psalm is that, if strict justice were God’s only consideration, he would have the right to bring dire judgment on those who sin (which includes all of his own people), and that the only possible appeal is to his mercy. The function of the psalm, as a song sung by the entire congregation, is to shape their hearts so that they feel this at the deepest level, lest they ever presume upon God’s grace.
NLT Study Bible:
your Holy Spirit: Or your spirit of holiness. Only the power of the Holy Spirit can change the human will to make it “loyal” (51:10) and “willing to obey”
”You haven’t really understood Psalm 51 until you have realized that every word of this penitential psalm cries for Jesus. Every promise embedded in this psalm looks for fulfillment in Jesus. Every need of Psalm 51 reaches out for help in Jesus. Every commitment of Psalm 51 honors Jesus. The sin that’s at the heart of this psalm will only ever find its cure in the grace of Jesus.
Yes, Psalm 51 is a prayer of confession. And it’s true that Psalm 51 is all about what true repentance produces in the heart and life of a man. Psalm 51 defines how true repentance always produces heartfelt worship. But more than anything else, Psalm 51 is Immanuel’s hymn. The forgiveness of Psalm 51 rests on the shoulders of the One whose name would be Immanuel. The Jesus who would provide everything that David (and we) need took a glorious name. It is a name whose implications are almost too wonderful to grasp and too lofty to imagine. It’s a name that summarizes everything the biblical narrative is about.”
–Paul David Tripp, Whiter Than Snow: Meditations on Sin and Mercy
John Bunyan, author of Pilgrim’s Progress, went through a period of two years where he felt very far from God. In his autobiography wrote that the words of Psalm 77 kept invading his mind: “Has the Lord rejected me forever? Will he never again show me favor?”
–Found in The One Year Book of Psalms