Notice the contrast David makes in verse 7. He is saying in effect, that those who don't trust in God will eventually come to nothing. At the same time, David realizes that not only is there a God who knows all things but he also desires God to guide his life. Therefore, David will not worry about the fate of the nonbeliever other than the fact that he will pray for them to realize the errors of their ways. Verse 7 is saying the bones of those who ignore God will eventually rot to nothing because they have ignored Him. In the meantime, David is trusting in God's guidance.
The phrase at the end of verse 8 says, "leave not my soul destitute". David is praying that God give him victory to not be given over to death. Yes David wants to be with God forever in heaven but that is not the issue here. The issue is about wasting time not doing God's will for our lives at any one moment. This is a prayer for the quantity of life (live longer), but it is also a prayer regarding the quality of life (live a life useful to God). To not be given over to death is a prayer that one uses their life to make a difference for Him. Anytime we are doing things that in effect are not His will, we are being given over to death.
How do I know if I am doing His will? Start by asking Him. Invest time in His word on a daily basis. Then it will become obvious to us when we are doing the right thing. Sometimes it is simply a matter of just going forward and trusting that He is guiding us. This does lead us back to this verse for if we are praying for God's protection, then we ask that He guides us down the path He desires for our lives.