1 Cor 15: 29- 34. You've picked one of the most difficult passages of scripture I think, so there's no one correct answer. I think the best answer is that Paul was asking a rhetorical question..to bolster his argument for the resurrection, "if the dead do not rise, why are they being baptized for the dead?"
PNT says:
Else what shall they do which are baptized for the dead? Paul again returns to the argument for the resurrection. This passage is difficult, and has received almost as many interpretations as there have been commentators. Some have held that there was a custom of baptizing living persons for the benefit of persons who had died without baptism. Had that custom existed, Paul would have rebuked it. It did arise afterwards, as an abuse from the misinterpretation of this passage, among the followers of Cerinthus, and, in our times, of Joseph Smith. I will try to make clear its meaning: (1) All the Corinthians were baptized (Act_18:8). (2) Their baptism was a "planting" in the likeness of the burial of Christ, and in the "likeness of his resurrection" (Rom_6:4-5). They were in, and raised from, a watery tomb. (3) Their baptism in the likeness of the death and resurrection of Christ was in hope of their own resurrection from the dead through Christ's resurrection. (Huper Nekroon, for, or on account of the dead, with the exception of resurrection from the dead.) But if Christ has not risen, and the dead rise not, this memorial and emblematic burial has no meaning. "Why, then, are they baptized for the dead?" that is, for the sake of their own resurrection from the dead. This interpretation harmonizes better with Paul's argument than any I have seen.