Spaceships give out a lot of heat, due to the fact that things produce heat and that heat must go somewhere. But, could a device exist in space that is efficient enough that the heat it produces (and so the heat it puts out) is low enough that it wouldn't be detectable without it breaking physics?
Because that would require perfection of efficiency. Not just ridiculously good efficiency, but perfection, which nudges right up there with perpetual motion machines.
However, you can get very, very close, thereby making the apparent heat signature of your ship tiny.
If you know where the observer(s) are, you can shield for that direction(s) only.
You can interpose something non-heated between yourself and the viewer.
You can radiate the heat away in a direction you know the viewers are not.
Good grief, you could even package the excess heat in little insulated containers, and eject them far away from you.
I prefer the active option. Kill the viewer before they realize they can see you. If you exterminate the observer before he can report, were you ever really observed?
It's hypothetically possible to cool the exterior of your vessel to the ambient temperature (cosmic background + interplanetary medium) and project the waste thermal energy away from the regions of space you want to avoid detection in.
However, in doing so you heat the interplanetary medium "behind" you, which could be detectable everywhere if it's a major increase or the medium is dense. It would work better in interstellar space, where the photons have a lot less particles along their paths to energize. To mitigate it you could widen the waste "beam"/cone, also widening the scope of regions that can detect you.
There are other problems as well. Stellar occultations can give you away, when your vessel in the foreground passes in front of distant stars/objects in the background.
An observer might also notice a difference in your temperature vs. the cosmic background radiation map, if they are searching for such small discrepancies.
Also have to say no. At the end of the day the amount of heat produced by an object correlates to the amount of 'work' that object can do. And by work I mean any useful form of output.
So yes, while you could easily place an object in space that produced little or no heat it would by also by default be incapable of doing anything particularly useful.
About the only thing you might be able to achieve would be run some very low/slow speed calculations on board on some kind of processor. And even then you'd need to go up and physically retrieve the outputs/solutions because there wouldn't be enough energy left over to power even a transmitter, let alone most of the conventional components of a space vessel.
I'm going to approach this question differently, since the reasons why the answer is essentially 'not completely' are well established in other answers.
Stealth is not about invisibility, it's about deception.
The goal of stealth needn't be that you're undetectable, the goal of stealth is to mask your true nature. Current generation stealth aircraft are not invisible to RADAR, they simply alter the nature of their return such that they are frequently overlooked as 'noise' or misclassified as non-military aircraft.
I learned this lesson from a friend who was an aerospace engineer, whose team was tasked with 'developing a battalion-level transport that utilized stealth capabilities.' They couldn't make such a large aircraft stealth enough to even get it dismissed as 'noise' but they could get it's RADAR signature small enough that anyone who detected it would think it was a small fighter - anything but a massive transport about to airdrop a full battalion on someone's head.
Tactical stealth just needs to be enough that your opponent, when (not if) they see you, is scratching their head trying to figure out what the hell is going on. Strategic stealth needs to just be enough so that your opponent misreads the situation and therefore acts inappropriately.
Famously, during the Japanese bombing attack on Pearl Harbor, and even without stealth technology at all, SCR-270-012's detection of the incoming attack aircraft was dismissed as an erroneous detection of a friendly bomber wing.
"Invisibility" is as much a function of the observer as the observed, so it is enough that a given object's behavior causes it to be misidentified.
Thermodynamics requires that for a heat engine to do useful work, you must transfer heat from a hot reservoir to a cold reservoir. The usual way of doing this is to have some sort of exothermic process (burning chemical fuel, nuclear reactor) as your hot reservoir and the environment as your cold reservoir. But you don't have to do it that way. You could instead carry in your ship two huge well-insulated thermal masses, one heated to a very high temperature, and the other cooled to a very low temperature. The passage of heat from one to the other powers your ship (and crew). All the waste heat is dumped into the cold mass.
This process continues until the temperatures in the two reservoirs equalise, at which point you need to return to base to 'refuel' or 'recharge'. That is, use external power to re-refrigerate your cold reservoir.
You then simply encase your space ship along with its heat reservoirs entirely inside a well-insulated box cooled to the same temperature as your environment. If the insulation is perfect, so no heat flows across it, this lasts indefinitely.
The main difficulty there is that the temperature of space is not uniform. It's 'warmer' nearer to stars than in the cold depths of interstellar space, and so the temperature an observer sees varies depending on what direction they are looking. The extreme case of course is when you pass exactly between the observer and a star, and block the light. And there are lots of stars! (It's how we've actually found some planets orbiting other stars - so very much within out technical capabilities.) So practically your aim would be not so much to be 'invisible' as to look 'just like any other nearby space rock'. Perfection would require some sort of holographic projection of the background, or a metamaterial shield to bend light around you or something of the sort. Simply cooling down to 'ambient' is an ill-defined concept, and far short of 'perfect'. It would still be detectable without breaking physics, although much, much harder.
You can be invisible when looked at from a specific direction.
Assume your ship makes waste heat. It does not need to leak out of everywhere willynilly. You can choose where to radiate it from. If you are worried about being seen by people you are approaching, you can approach from behind a shield that you have cooled down to simulate background radiation. You can radiate the heat from that shields and the rest of your waste heat in the opposite direction.
The issue about occulting stars could be solved by a long thin ship. You point it in the direction you are going, and where you are concerned about viewers.
You will be very obvious to anything approaching from your rear. If there are particles behind you they might be heated by your IR exhaust.
Heat is energy, it's not produced, it's only transformed, eventually from matter ($e = mc^2$). Your spaceship can have a visible part (visible to detectors) which can be maintained cool. One only need to transfer the heat to another place (reservoir) which won't be exposed to detection.
In that case, whatever the efficiency, the spaceship will remain enough stealth to heat detection. This is stealth by compensation.
About stealth by design. From the nature: birds do fly, they transform heat (from sugar to mechanical energy), and are very efficient (little sugar energy will increase temperature). But there is still a bit of flight energy lost into friction, noise and turbulence during the flight. Owls are super efficient on the noise part, but this requires a limited flight speed. You can imagine a spaceship that has this kind of efficiency and stealth.
Run a backwards nuclear reactor
As noted in most answers you cannot destroy energy. Furthermore, 100% efficiency is also not possible due to the laws of thermodynamics. So your best bet is to store the heat internally, or what I would suggest convert it into mass.
A nuclear fission process is energy positive when splitting atoms heavier than iron, while a fusion process is positive while fusing atoms lighter than iron. In principle, you could fuse heavy elements together (make sure your end product is stable) and in this way convert energy to mass. This all within the bounds of physics as we know it. The only downside is you would get heavier the more energy you convert, but I think not much compared to the weight of the spaceship.
Implementation: I would expect a spaceship that cools its outer shell close to absolute zero and draw all the thermal energy inwards. Inside the spaceship this thermal energy is used by a backwards nuclear reactor, either directly or indirectly, to convert energy to mass. I would expect it to be coupled with a normal (probably fusion) reactor so that it is possible to create a fuel cycle. Creating fuel if you need to destroy heat, and using that fuel if you suddenly need energy.
It is Actually Quite Easy
Don't believe the lies about no stealth in space! Military grade IR scanners on Earth can detect a fighter jet at a range of about 50 km from front and 90 km from rear. But here is the thing most people don't consider: the average jet engine's exhaust is about 900°C. That means that a jet creates twice as much thermal contrast between the atmosphere and its exhaust as you see between a room temperature object in space and the vacuum of space. That much atmosphere also absorbs about 50-70% of light over those distances. So, this means that the effective range of thermal scanners for detecting a fighter sized ship in space can be approximated at about 150-500km... but in space, this is not very far at all. That means that you would need about 10,000 such IR satellites to detect space fighters using active propulsion or 650,000 such IR satellites to detect all fighters that are running at more room temperature just to get full thermal scanner coverage of things in Low Earth Orbit. As for things like detecting ships off in deep space you can pretty much forget thermal detection as viable option.
The idea of no stealth in space comes from the concept that there is no atmosphere to absorb the IR emissions of a ship, but this ignores the more important factor in detection ranges which is the visual angle to an object. The smaller your visual angle to the emitter, the less of the actual emissions will reach you because they are spreading out in every direction. It does not matter how bright a thing is if it is too far away to see. This is the same reason you can only see a few of the billions of billions of stars in the universe when you look up at night.
Heat is entropy. Entropy in a closed system always increases, and Entropy is so much heat that early versions of thermodynamics talked about Heat flow and waste Heat only.
But Heat is just a kind of entropy.
Entropy is information; Heat is a kind of ridiculously complex and useless information (carried by various media) that our useful machines "bleed off" in their attempt to keep things ordered and simple and produce useful work.
The thing is, Entropy goes up really fast when we do "useful work" at a macro scale, and the only practical way we have of dealing with it is to produce Heat and let that be emitted.
What are the ways around this?
You can make machines whose operation is fully invertible that do not produce waste Entropy like machines we make today. This kind of operation is far far far far harder than it sounds. But, in theory, a computer thing doing only reversible computation could do "useful" "work" and not emit heat. (scare quotes are on purpose; the theoretical limitations on what can be done reverisbly is bad enough, the practical ones are insanely worse.)
You can direct the heat loss away from the sensors. The idea of a heat-pump laser, or even putting a cooled plate in one direction while letting heat be emitted in all other directions. This will heat the ISM in directions you don't shield from, and that in turn can be detected.
You could in theory put the entropy into something that isn't emitted heat. An example of that would be carrying around a heat-sink, like water, and boiling it, but on a ridiculously crazier scale. Imagine a space ship with a black hole that dumps its waste heat into that black hole, or something even more exotic. The CMB is 2.7 K; the mass of a 0.6 lunar mass black hole is about that. So if you have a black hole that big or heavier, you could thermally couple with it and dump waste heat in it to drop your temperature down to CMB or lower.