Unfortunately, the Chapter 7 bankruptcy will not solve your problem. You would not be able to file Chapter 7 bankruptcy and protect the RV from repossession because you are delinquent on the payment. The lender will file a motion with the bankruptcy court showing that you are delinquent so that it can repossess the RV.
Fortunately, you do have the option of filing a Chapter 13 bankruptcy. This is more commonly known as a reorganization bankruptcy in which you can pay back your delinquent RV payments over the next three to five years.
You will have to make all regular RV payments each month after filing the case along with a payment to the court-appointed Chapter 13 trustee. The trustee will then send a payment to the lender in order to bring the RV loan current. You will emerge from the bankruptcy current on the loan.
There is another available option inside the Chapter 13 since you state that the RV value is significantly less than what you currently owe on the loan. You may be able to lower the loan balance to the fair market value so long as you can pay off that amount within the five-year Chapter 13 term.
The RV may be worth only $40,000, but you owe $80,000. You could pay off the $40,000 plus a reasonable rate of interest -- 5 percent -- over the next five years. The remaining balance would be eliminated once you complete your payment plan. This is called a "cramdown" and is quite common in cases like yours.
The lender will likely fight you on the value, trying to push up the payoff, and you will likely need to get an appraisal prior to filing. However, these would be worthwhile costs if you are going to be able to eliminate close to half of the loan balance.
Seek out an experienced bankruptcy attorney and good luck!