A few considerations to note here.
As a general matter, I think the answer to your question is yes, although it is not ideal. You can have a loft in a wooded area. Ideally a loft will be in the middle of an open field, however, homers can still find their way back to a loft in woods. I forget whether it is on this forum or another pigeon forum, but there is a guy who keeps many pigeons in the Philippines, whose loft is in the woods, and he says he has no issues. I have likewise seen many videos of fanciers keeping their lofts in what appears to be wooded areas. There are also tons of people who keep lofts in urban jungles, of course.
One complication will be that it'll be a bit harder to train them to find that loft. They can do it, they are smart, but it's just not as easy as if the loft was out in the open. My loft is in my small back yard, there are many trees, and houses around, so it is not a ton different than if I had a loft in the woods. The process of starting my loft I think was a bit more difficult than most people, but I did it nonetheless.
If you loft fly your birds and they end up staying out past dark, they will be at a much greater risk of being killed by owls.