This sentence is far from easy even for native English speakers! But we can get at its meaning if we pay attention to the context, and take it word by word.
Ishmael is attending the Sunday morning service at the Whaleman’s Chapel (a lightly fictionalized Seamen's Bethel) in New Bedford, Massachusetts. On the walls of the chapel are marble tablets commemorating sailors who were lost at sea, for example one reads:

Ishmael ponders on the feelings of the relatives of these dead sailors, and imagines that their grief is increased by the loss of the body of the deceased. When a loved one is buried in the churchyard, Ishmael says, there is some comfort in being able to lay flowers on their grave, but in the case of men lost at sea, there are only “black-bordered marbles which cover no ashes”. Then we get to the difficult sentence.
The “deadly voids” are the absences (“voids”) of the bodies of the dead sailors (“deadly” in the sense “relating to the dead”, not in the usual sense of “fatal”); these absences being implied by the wording of the tablets (“lost overboard”, “towed out of sight by a whale”, etc.)
The “unbidden infidelities” are “infidelities” (losses of faith) in the Christian promise of resurrection; losses that are not “bidden” (directed) by the tablets but nevertheless suggested or provoked by them. Ishmael sees, or imagines, that the bereaved members of the congregation receive little consolation from their religion.
The “lines” are the epitaphs carved on the tablets.
The tablets “gnaw upon all Faith” by “gnawing” (eating away at) the certainty of resurrection, undermining the whole of Christian belief.
The tablets “refuse resurrection to the beings who have placelessly perished without a grave” because the Christian idea of life after death is based on the idea of bodily resurrection, for example, in John 5:28–29, “all that are in the graves shall hear his voice, and shall come forth”, or Matthew 27:52–53, “the graves were opened; and many bodies of the saints which slept arose, and came out of the graves after his resurrection”. But how can a sailor “come out of his grave” if his body was lost at sea and he has no grave?
It is perhaps no coincidence that the last of the cenotaphs observed by Ishmael in the Whaleman’s Chapel is dedicated to a captain named Ezekiel Hardy. In the contexts of burial and bereavement, the captain’s name conjures images of the Valley of Dry Bones that God reveals to Ezekiel the prophet. Despite its initially grim appearance, this biblical valley is a trope of optimism: the Lord shows Ezekiel how the power of the Holy Spirit can restore flesh and skin to the desiccated, scattered remains and breathe new life into lifeless bodies (Ezek. 37:1–10). The dry bones of the valley attest, not to the finality of loss, but to the miraculous power of the Lord to bring new life to the spiritually desolate. Melville, however, renders darker prophecies than Ezekiel. In his narrative, the prospect of resurrection is thwarted because Captain Hardy has left no bones to rejoin and return to the flesh. The bones of Melville’s Ezekiel lie not in a dry valley, but beneath the waters of the Pacific; the wherewithal for the performance of the miracle has been lost.
John T. Matteson (2006). ‘“Deadly Voids and Unbidden Infidelities”: Death, Memory and the Law in Moby-Dick’. In John Bryant, Mary K. Bercaw Edwards, and Timothy Marr, eds. “Ungraspable Phantom”: Essays on Moby-Dick, p. 124. Kent State University Press.