We don't. Thus is the way of science that you can never say anything is "zero" just "at least smaller than my current resolution". Though, for example, for Coulomb's Law deviations from a perfect inverse square law must be smaller than 1 part in 1,000,000,000,000,000 (10^15 ).
From a theoretical perspective it's "easy", at least in some cases. Point-source solutions of the wave equation (a second order partial differential equation that pops up in elastic and EM waves) require exact 1/r^2 spreading of energy (plus conservation of energy requires it). Point source solutions of Laplace's equation (which shows up in gravity, electrostatics, and any steady-state diffusive process) also have an exact inverse square relationship, but for force instead of energy.
These are theoretical results, not empirical results, and must be exact to the degree that the theory's assumptions are exact.
As it has already been pointed out, theoretically it's kind of easy, but experimentally you can never be completely sure (albeit deviations from the inverse square laws have been bounded to be tremendously small).
It's also worth mentioning that the fact that we live in a 3D* world is a very good indicator that this law is, indeed, true.
*: more or less.