However, the precise location can vary slightly depending on the specific engine configuration and accessories installed. A repair manual specific to your year and model vehicle would be the best source for the exact location. You can also find diagrams online if you search for "2005 Chevy 2500HD 6.0L knock sensor location" along with images.
Be cautious when attempting to locate it yourself. The engine compartment is hot when the engine is running and contains many hot components. Always disconnect the negative battery terminal before working near any electrical connections.