This cannot be done using conventional physics. If you are willing to bend the laws of physics until they snap, there are some options.
A black hole sun is easy
The real universe is filled with "light", but it is so dark and redshifted that only special instruments can see it: the cosmic background radiation. Perhaps our universe is younger than our real universe, so it is smaller and the radiation shines brighter, and creatures evolved to see by the light of the background radiation.
Moreover, the background radiation in our fantasy universe does not consist of photons, but another elemental particle that could only be formed in the extreme conditions of the big bang.
Stars are perfectly normal, and emit perfectly normal photons, but our creatures cannot see photons. They evolved to see only the special particle in the background radiation, perhaps because they emerged on the back side of a tidally locked planet or before their sun ignited. To them, the sun is black, casting a shadow but generating heat. It would look like a "black hole sun", but would not be an effective source of night.
Antiphotons (sort of)
If we want more effective darkness, we need two further changes to the laws of physics: the exotic particle that makes up the background radiation is actually an antiphoton, and regular photons only interact with antimatter while antiphotons only interact with regular matter. This has no parallels in real life, but real life has stranger phenomena, such as particles that could be interpreted to look different when you rotate them 360 degrees. 781
"It's quantum physics" could be a valid handwave here.
(Note that real world antiparticles are regular particles with an opposite electric charge and opposite quarks, and photons have neither, so antiphotons either don't exist or are technically just photons. Perhaps our fantasy "photons" are baryonic particles instead?)
Changing the background radiation to antiphotons allows the sunlight, consisting of invisible photons, to annihilate the cosmic background radiation, consisting of visible antiphotons, creating darkness and emitting neutrinos or other non-interacting particles. Any excess photons from the sun will pass through the planet without interacting with it, explaining why the sun does not generate heat and why the species did not evolve to see sunlight.
The sun will not cast "rays" of darkness, but will extinguish the light across the entire sky. On the opposite side of the sun, there is a large glowing circle that does not fully cover its half of the skydome and is brightest in its center, fading to darkness along the edges. The brightest time of the day would be when the sun is directly underneath and the glow is directly overhead, but at that time the horizon would be dark.
And every once in a great while, the sun could reflect off a more distant planet and create an "eclipse".
The brightness of the sun matters. The sun is always going to be brighter than the background radiation and thus fill space with more particles (otherwise it would overheat and blow up) but particles are small and the incoming antiphotons may survive the flak barrage of photons from the sun and make it to the observer. There is a balance where few antiphotons from the direction of the sun survive but most antiphotons from the opposite direction survive, but it would only generate pleasing results on a narrow band of planets, with most others being eternally bright or fully dark.
As a side effect, because the photons emitted during fusion now no longer interact with solar matter, the sun will be slightly smaller, slightly hotter, have a slightly shorter lifespan, lack a measurable solar wind and be slightly more likely to implode into a black hole at the end of its lifespan. 43