There is no general way for that, but there is a way which works in most cases.
The reason, why there is no general way for that, that also the kernel doesn't know it. To know it, first it would need to analyze the partition.
Without mounting the partition, the kernel knows only its existence, but no more. Essentially, it is a line of blocks with random data. The kernel knows, where is it and how to access, but doesn't know, what to do with it.
However, there are also user-space tools which can analyze the content of a filesystem, without mounting them. As all the filesystems have very different data structures, to handle them you need different tools.
In the case of ext2/3/4, it is
# dumpe2fs /dev/your_root|grep '^Free blocks'
dumpe2fs 1.42.13 (17-May-2015)
Free blocks: 5721580