Neglected pipework led to risk of potentially catastrophic explosive and flammable mixture, court hears