Sometimes we come across situation where in the Entire Space in TempDB will be unallocated space but we are unable to free up space neither we are able to shrink the database or file. This was how I was able to Free Up the unallocated space and it worked for me. So thought of sharing it.
DBCC FREESYSTEMCACHE (‘ALL’)
dbcc shrinkfile (<TempDBLogicalFileName>,SizeInMB)
Note: Logical File name can be obtained using SP_HELPFILE